package com.example.androidframework.ui.mall.holder

import android.annotation.SuppressLint
import android.view.View
import com.bumptech.glide.Glide
import com.example.androidframework.R
import com.example.androidframework.databinding.ItemMallGoodsHotBinding
import com.martin.lib_base.annotation.ItemData
import com.martin.lib_base.base.BaseViewHolder
import com.martin.lib_base.bean.app.mall.RecommendGoodsBean
import com.martin.lib_base.interfaces.IItemData

@ItemData(HotGoodsViewHolder.Companion.ItemData::class)
class HotGoodsViewHolder(view: View) : BaseViewHolder<RecommendGoodsBean, ItemMallGoodsHotBinding>(view) {
    @SuppressLint("SetTextI18n")
    override fun onBindViewHolder(position: Int, item: Any?) {
        val bean: RecommendGoodsBean? = getItemBean(item)
        bean?.let {
            Glide.with(itemView.context).load(bean.thumb).into(binding.image)
            binding.title.text = bean.name
            binding.price.text = "¥${bean.present_price}"

            itemView.setOnClickListener {

            }
        }
    }

    companion object {
        class ItemData: IItemData {
            override fun getItemLayoutId(): Int {
                return R.layout.item_mall_goods_hot
            }

        }
    }
}